﻿// ==================================================
// Copyright © 2016 杭州伯庸科技 版权所有
//
// 文 件 名：ClearResult
// 功能描述：
//
// 创建标识：Yu.Liang(俞 亮) 2018/3/25 23:55:44
//
// 修改标识：
// 修改描述：
// ==================================================

using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using Shine.Framework;

namespace Shine.Measure
{
    public class ClearResult : BaseCommand
    {
        IApplication m_Application = null;
        public ClearResult()
        {
            base.m_caption = "清除";
            base.m_name = "MeasureH";
            base.m_toolTip = "清除";
            base.m_message = "清除";
            base.m_category = "Measure";
        }

        public override void OnCreate(object hook)
        {
            m_Application = hook as IApplication;
        }

        public override void OnClick()
        {
            (m_Application as IFramework).SceneControl.Scene.TrackingLayer.Clear();
            (m_Application as IFramework).SceneControl.Action = SuperMap.UI.Action3D.Pan;
        }

        public override int Bitmap
        {
            get
            {

                string imgFile = Application.StartupPath + "\\Images\\" + GetType().Name + ".png";

                if (System.IO.File.Exists(imgFile) == false) return 0;

                return new Bitmap(Image.FromFile(imgFile)).GetHbitmap().ToInt32();
            }
        }

        public override bool Enabled
        {
            get
            {
                return (m_Application as IFramework).IsMapCtrlactive; 
            }
        }
    }

}
